package com.scjp.chapter3.stack_heap_example;

import java.awt.Dimension;

public class ReferenceTest {

	public static void main(String[] args) {
		
		Dimension a = new Dimension(5, 10);
		ReferenceTest rt = new ReferenceTest();
		
		System.out.println("a.height = " + a.height);
		
		rt.modify(a);
		
		Dimension b = a;
		b.height = 30;
		System.out.println("a.height = " + a.height + " and a.width = " + a.width + " after change to b");
	}
	
	void modify(Dimension dim) {
		dim.height = dim.height + 1;
		dim.width = dim.width - 2;
		System.out.println("dim.height = " + dim.height + " ; dim.width = " + dim.width);
	}

}
